/**
 * Project Name:springBoot-serviceImpl
 * File Name:SendManyServiceImpl.java
 * Package Name:com.libra.rabbitmq.hello.serviceImp
 * Date:2018年8月18日下午6:47:05
 * Copyright (c) 2018, wangzhch All Rights Reserved.
 *
*/

package com.libra.rabbitmq.hello.serviceImp;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import com.alibaba.fastjson.JSON;
import com.libra.model.mq.Teacher;
import com.libra.rabbitmq.config.QueueConstants;

/**
 * ClassName: manyToMany写入消息 <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason:	 TODO ADD REASON. <br/>
 * Date:     2018年8月18日 下午6:47:05 <br/>
 * @author   wangzhch
 * @version  
 * @since    JDK 1.8
 * @see 	 
 */
@Configuration
public class SendManyServiceImpl {
	Logger logger = LoggerFactory.getLogger(SendManyServiceImpl.class);
	
	@Autowired
	private RabbitTemplate rabbitTemplate;
	public void manyToMany(Teacher teacher) {
		logger.info("manyToMany写入消息内容2:{}", JSON.toJSONString(teacher));
		rabbitTemplate.convertAndSend(QueueConstants.MESSAGE_EXCHANGE,QueueConstants.MESSAGE_ROUTE_KEY,teacher);
	}
}

